import { ComponentInternalInstance, getCurrentInstance } from "vue";
import { VueCookies } from "vue-cookies";

// 声明合并来添加自定义属性
declare module "vue" {
  interface ComponentCustomProperties {
    // 声明自定义全局属性
    Request: RequestType;
    Message: Message;
    Confirm: Confirm;
    Verify: Verify;
    Utils: Utils;
    VueCookies: VueCookies;
    globalInfo: {
      avatarUrl: string;
      imageUrl: string;
    };
  }
}

// 定义全局变量
export const useGlobelProperties = () => {
  const { appContext } = getCurrentInstance() as ComponentInternalInstance;
  return appContext.config.globalProperties;
};
